package com.jackchan.homework.sysw.entity;

import com.jackchan.homework.common.IdEntity;

import javax.persistence.*;

/**
 * Created by ch-hui on 15/12/24.
 * 库存表
 */

@Entity
@Table(name = "t_stock")
public class Stock extends IdEntity {

    // 库存类型 0 原料 1 产品
    private Integer stockType;

    // 产品
    private Product product;

    // 原料
    private Material material;

    // 库存量（公斤）
    private Double quantity;

    // 谷值预警
    private Integer min;

    // 峰值预警
    private Integer max;

    // 预警手机号
    private Integer warningPhone;

    @Column(name = "stock_type")
    public Integer getStockType() {
        return stockType;
    }

    public void setStockType(Integer stockType) {
        this.stockType = stockType;
    }

    @ManyToOne
    @JoinColumn(name = "product_id", referencedColumnName = "id")
    public Product getProduct() {
        return product;
    }

    public void setProduct(Product product) {
        this.product = product;
    }

    @ManyToOne
    @JoinColumn(name = "material_id", referencedColumnName = "id")
    public Material getMaterial() {
        return material;
    }

    public void setMaterial(Material material) {
        this.material = material;
    }

    @Column(name = "quantity")
    public Double getQuantity() {
        return quantity;
    }

    public void setQuantity(Double quantity) {
        this.quantity = quantity;
    }

    @Column(name = "min")
    public Integer getMin() {
        return min;
    }

    public void setMin(Integer min) {
        this.min = min;
    }

    @Column(name = "max")
    public Integer getMax() {
        return max;
    }

    public void setMax(Integer max) {
        this.max = max;
    }

    @Column(name = "message_phone")
    public Integer getWarningPhone() {
        return warningPhone;
    }

    public void setWarningPhone(Integer warningPhone) {
        this.warningPhone = warningPhone;
    }
}
